package statcomponent.rules;

import constants.NumberConstants;
import statcomponent.AbstractStatRule;

import java.math.BigDecimal;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;

/**
 * BigDecimal类型-统计规则
 *
 * @author chenfoxin
 * @date 2022年09月05日 9:58
 */
public class BigDecimalStatRule extends AbstractStatRule<BigDecimal,BigDecimal> {
    private final BigDecimal result = BigDecimal.ZERO;

    @Override
    public void doStat(BigDecimal statValue) {
        result.add(Objects.isNull(statValue) ? BigDecimal.ZERO : statValue);
    }

    @Override
    public BigDecimal result() {
        return result;
    }
}